<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1" session="true"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page import="java.util.*, loginbean.*" %>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
		<title>Create a New Work Flow</title>
		<script type="text/javascript">
			var counter = 0;

			function moreFields() 
			{
				counter++;
				var newFields = document.getElementById('readroot').cloneNode(true);
				newFields.id = '';
				newFields.style.display = 'block';
				var newField = newFields.childNodes;
				for (var i = 0; i < newField.length; i++) 
				{
					var theName = newField[i].name
					if (theName)
						newField[i].name = theName + counter;
				}
				var insertHere = document.getElementById('writeroot');
				insertHere.parentNode.insertBefore(newFields,insertHere);
			}
	
			window.onload = moreFields;
		</script>
	</head>
	<body>
		<div id="readroot" style="display: none">
			Select a Web Service: 
			<% out.println(WorkFlow.getAllWebServices( Integer.parseInt( session.getAttribute("tenantid").toString() ) ) ); %>
		</div>
		<form action="workflowcontroller" method=post>
			Work Flow Name: <input type="text" name="workflowname" value="" />
			<input type="hidden" name="viewcmd" value="A" />
			
			<span id="writeroot"></span>

			<input type="button" value="Add Another Web Service" onclick="moreFields()" />
			<input type="submit" value="Create Work Flow" />
		</form>
	</body>
</html>